<template>
	<view class="">
		<view class="padding" @click="shezhi">
			<view class="flexbetween">
				<view class="">修改密码</view>
				<image src="/static/image/my/grey_icon.png" mode="" class="icons"></image>
			</view>
		</view>
		<view class="padding" @click="we">
			<view class="flexbetween">
				<view class="">更换手机号</view>
				<image src="/static/image/my/grey_icon.png" mode="" class="icons"></image>
			</view>
		</view>
		<view class="padding" @click="setzfb">
			<view class="flexbetween">
				<view class="">实名认证</view>
				<image src="/static/image/my/grey_icon.png" mode="" class="icons"></image>
			</view>
		</view>
		<view class="ljbd">
			<view class="bigbtn" @click="toout">退出登录</view>
		</view>
		<u-modal :show="show" :title="title" showCancelButton="true" confirmColor="RGBA(212, 139, 57, 1)"
			@confirm="confirm" @cancel="cancel"></u-modal>
		<u-modal :show="loshow" :title="lotitle" showCancelButton="true" confirmColor="RGBA(212, 139, 57, 1)"
			@cancel="locancel" @confirm="loconfirm" confirmText="去登录"></u-modal>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				title: '您确定要退出登录吗',
				loshow: false, //登录弹窗
				lotitle: '请登录后再查看!',
				userinfo: {}
			}
		},
		onLoad() {
			this.init()
		},
		methods: {
			init() {
				httpRequest.request('/api/user/index', 'GET', {}, false, false, true).then(res => {
					if (res.code == 1) {
						this.userinfo = res.data
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			shezhi() {
				/* 	let _this=this
					if (!uni.getStorageSync('token')) {
						_this.loshow = true;
						return
					} */
				uni.navigateTo({
					url: "/pages_my/xuigai"
				})
			},
			setzfb() { //
				/* 	let _this=this
					if (!uni.getStorageSync('token')) {
						_this.loshow = true;
						return
					} */
				if (this.userinfo.realname_status == 1) {
					uni.navigateTo({
						url: "/pages_my/shimingrz"
					})
				}else{
					uni.navigateTo({
						url: "/pages_my/shenhe"
					})
				}
			},
			locancel() {
				this.loshow = false;
			},
			loconfirm() {
				this.loshow = false;
				uni.navigateTo({
					url: '/pages/login/login'
				})
			},
			confirm() {
				uni.removeStorageSync('token');
				uni.removeStorageSync('user_id');
				this.show = false;
				uni.navigateBack(1);
			},
			we() {
				/* 	let _this=this
					if (!uni.getStorageSync('token')) {
						_this.loshow = true;
						return
					} */
				uni.navigateTo({
					url: "/pages_my/genghuansjh"
				})
			},
			cancel() {
				this.show = false;
			},
			//退出登录
			toout() {
				let _this = this
				if (!uni.getStorageSync('token')) {
					_this.loshow = true;
					return
				}
				this.show = true;
			},
		}
	}
</script>

<style lang="scss">
	.ljbd {
		//position: fixed;
		padding: 0rpx 38rpx;
		bottom: 50rpx;
		left: 30rpx;
		right: 30rpx;
	}

	.icons {
		width: 16rpx;
		height: 28rpx;
		background-repeat: no-repeat;
	}

	.bigbtn {
		background-color: RGBA(212, 139, 57, 1);
		border-radius: 41rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 82rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		margin-top: 400rpx;
	}
</style>